<!DOCTYPE html>
<%@page import="com.faeple.util.SessionManager"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ page language="java" contentType="text/html;  charset=utf-8" pageEncoding="utf-8"%>
<html lang="ko">
	<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	
	<title>Faeple</title>
	
	<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
	<!--[if lt IE 9]>
		<script src="/resources/js/html5shiv.js"></script>
		<script src="/resources/js/respond.min.js"></script>
	<![endif]-->
	<link href='http://fonts.googleapis.com/css?family=Alef' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="/resources/css/font-awesome.css">
	<link rel="stylesheet" href="http://fonts.googleapis.com/earlyaccess/nanumgothic.css">
	<style type="text/css">
		body {
			color:#333;
		}
	</style>
</head>
<body>
<%@ include file="menu.jsp" %>

<div class="container">
	<div class="page-header">
		<h2 id="tables">공지사항<small>&nbsp;${totalCount}개</small></h2>
    </div>
    <div>
    	<div style="height:40px; position: relative; margin-bottom:15px;">
    		<div style="height:40px; float:right; width: 305px;">
    			<div style="position: relative;">
    				<form method="get" action="/config/admin/notice" class="form-inline">
		    			<select class="form-control" style="margin-right:5px;" id="searchType" name="searchType">
		    				<option value="title">제목</option>
		    				<option value="content">내용</option>
		    			</select>
						<div class="input-group" style="width: 200px;">
							<input type="text" class="form-control" id="searchValue" name="searchValue" value="${searchValue}">
							<span class="input-group-btn">
								<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
							</span>
						</div>
					</form>
    			</div>
    		</div>
    	</div>
    	<div class="table-responsive">
		    <table class="table table-hover">
				<thead>
					<tr>
						<th>제목</th>
						<th>날짜</th>
					</tr>
				</thead>
				<tbody>
					<c:if test="${fn:length(notices) ne 0}">
					<c:forEach items="${notices}" var="item">
						<tr>
							<td><a href="noticeView?idx=${item.idx}">${item.title}</a></td>
							<td>${item.createdate}</td>
						</tr>
					</c:forEach>
					</c:if>
					<c:if test="${fn:length(notices) eq 0}">
						<tr>
							<td colspan="2" style="text-align:center;">검색된 결과가 없습니다</td>
						</tr>
					</c:if>
				</tbody>
			</table>
		</div>
    </div>
    <div>
		<div style="float:left;">
			
		</div>
		<div style="float:right;">
			<a href="noticeWriteForm" class="btn btn-primary">글쓰기</a>
		</div>
		<div class="clearfix"></div>
	</div>
</div>
</body>
<script src="/resources/js/jquery-1.11.0.js"></script>
<script src="/resources/js/jquery-ui-1.10.4.custom.min.js"></script>
<script src="/resources/js/bootstrap.js"></script>
<script type="text/javascript">
	$(function(){
		$(".navbar-nav").children("li").eq(4).addClass("active");
		
		if("${searchType}" == "title"){
			$("#searchType option:eq(0)").attr("selected","selected");
		}else if("${searchType}" == "content"){
			$("#searchType option:eq(1)").attr("selected","selected");
		}
	});
</script>
</html>